package com.lyn;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;

public class DBUtilsHelper {
	private DataSource dataSource = null;
	private QueryRunner queryRunner = null;
	
	public DBUtilsHelper() {
		try {
			this.dataSource = DBPoolConnection.getInstance().getDataSource();
		} catch(SQLException e) {
			e.printStackTrace();
		}
		if(this.dataSource!=null) {
			this.queryRunner = new QueryRunner(this.dataSource);
		}
	}
	
	public DBUtilsHelper(DataSource dataSource) {
		this.dataSource = dataSource;
		this.queryRunner = new QueryRunner(this.dataSource);
	}
	
	public QueryRunner getQueryRunner() {
		return this.queryRunner;
	}
	
}
